#!/usr/bin/python
# -*- coding: UTF-8 -*-

# 新式类标签
__metaclass__=type

class SomeCustomException(Exception):pass

class MuffledCalculator:
	muffled = False
	def calc(self, expr):
		try:
			return eval(expr)
		except ZeroDivisionError:
			if self.muffled:
				print 'Division by zero illegal'
			else:
				raise Exception('被除数禁止为0')

cal = MuffledCalculator()
cal.calc('10/2')

# cal.calc('10/0')

cal.muffled = True
cal.calc('10/0')


class calNum:

	def calnumbers(self, x, y):
		try:
			print x/y

		except (ZeroDivisionError, TypeError), e:

			print e



ca = calNum()
ca.calnumbers(10, 0)











